<template>
  <div class="left-container">
    <h3>Left 组件 --- {{ count }}</h3>
    <button @click="count += 1">+1</button>
    <button @click="resetCount">重置</button>
  </div>
</template>

<script>
export default {
  data() {
    return {
      count: 0
    }
  },
  methods: {
    resetCount() {
      this.count = 0
    }
  },
  created(){
    console.log('left is created')
  },
  destroyed(){
    console.log('left is destroyed')
  },
  //keep-alive生命周期中的组件被激活状态
  //注意！！！！当组件第一次被创建的时候既会执行created生命周期也会执行activated的生命周期
  activated(){
    console.log('Left组件被激活')
  },
  // keep-alive生命周期中组件被缓存状态
  deactivated(){
    console.log('Left组件被缓存')
  }
}
</script>

<style lang="less">
.left-container {
  padding: 0 20px 20px;
  background-color: orange;
  min-height: 250px;
  flex: 1;
}
</style>
